import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yysk_app/pages/nft_pages/wallet_pages/enterprise_auth/enterprise_auth_page.dart';
import 'package:yysk_app/pages/nft_pages/wallet_pages/wallet/wallet_controller.dart';
import 'package:yysk_app/pages/nft_pages/wallet_pages/wallet_enterprise/wallet_enterprise_page.dart';
import 'package:yysk_app/utils/colors.dart';
import 'package:yysk_app/utils/helper.dart';
import 'package:yysk_app/widget/button_widget.dart';
import 'package:yysk_app/widget/custom_app_bar2.dart';
import 'package:yysk_app/widget/image_asset_widget.dart';

class AuthFailPage extends StatelessWidget {
  static const path = '/authFail';
  final String reason;
  const AuthFailPage({super.key, this.reason = '这里是失败原因'});

  @override
  Widget build(BuildContext context) {
    final double top = MediaQuery.of(context).padding.top;
    final reason = Get.arguments?['reason'] ?? '开户失败';
    // WalletController walletController = Get.find();

    return Scaffold(
      body: Stack(
          children: [
            //添加背景色，代码如下：
            SizedBox(
              width: context.width,
              child: ImageAssetWidget(
                width: double.infinity,
                height: 173.px,
                imageUrl: 'static/images/wallet/top_bg.png',
              ),
            ),
            Padding(
              padding: EdgeInsets.fromLTRB(0, top, 0, 24.px),
              child: Column(
                  children: [
                    CustomAppBar2(title: '认证评估', context: context),
                    Expanded(
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          const SizedBox(height: 60),
                          // 失败icon
                          ImageAssetWidget(
                            imageUrl: 'static/images/wallet/open_wallet_fail.png',
                            width: 148,
                            height: 130,
                          ),
                          const SizedBox(height: 32),
                          const Text('审核未通过', style: TextStyle(color: AppColors.fontColorGreen ,fontSize: 30, fontWeight: FontWeight.bold, fontFamily: 'CustomFont')),
                          const SizedBox(height: 12),
                          Text('原因：$reason', style: const TextStyle(fontSize: 14)),
                          const SizedBox(height: 32),
                          ButtonWidget(
                            label: '重新认证',
                            height: 32.px,
                            width: 106.px,
                            fontSize: 12.px,
                            fontColor: AppColors.fontColorGreen,
                            imageBg: 'static/images/wallet/wallet_cancel_btn.png',
                            contentType: ContentType.text,
                            onPressed: () {
                               Get.back();
                                Get.toNamed(EnterpriseAuthPage.path,arguments: {'isAuthed':false});
                            },
                          ),
                          Spacer()
                          // OutlinedButton(
                          //   onPressed: controller.retry,
                          //   style: OutlinedButton.styleFrom(
                          //     side: const BorderSide(color: Colors.black),
                          //     shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
                          //     padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 12),
                          //   ),
                          //   child: const Text('重新开通', style: TextStyle(fontSize: 18, color: Colors.black)),
                          // ),
                        ],
                      ),
                    ),
                  ],
                ),
            ),
          ],
        ),
      
      // Column(
      //   mainAxisAlignment: MainAxisAlignment.center,
      //   children: [
      //     const Spacer(),
      //     Center(
      //       child: Container(
      //         width: 160,
      //         height: 160,
      //         decoration: BoxDecoration(
      //           shape: BoxShape.circle,
      //           color: const Color(0xFFB2E9E2).withOpacity(0.3),
      //           border: Border.all(color: const Color(0xFFB2E9E2), width: 4),
      //         ),
      //         alignment: Alignment.center,
      //         child: const Text('X', style: TextStyle(fontSize: 64, color: Color(0xFF6CBF3C), fontWeight: FontWeight.bold)),
      //       ),
      //     ),
      //     const SizedBox(height: 32),
      //     const Text('审核未通过', style: TextStyle(fontSize: 28.px, color: Colors.black, fontWeight: FontWeight.bold)),
      //     const SizedBox(height: 12),
      //     Text('原因：$reason', style: const TextStyle(fontSize: 16, color: Colors.black87)),
      //     const SizedBox(height: 32),
      //     SizedBox(
      //       width: 180,
      //       height: 44,
      //       child: OutlinedButton(
      //         onPressed: () => Get.offAllNamed(EnterpriseAuthPage.path),
      //         style: OutlinedButton.styleFrom(
      //           side: const BorderSide(color: Color(0xFFB2E9E2)),
      //           shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
      //           backgroundColor: const Color(0xFFE6FFF8),
      //         ),
      //         child: const Text('重新认证', style: TextStyle(fontSize: 18, color: Color(0xFF6CBF3C))),
      //       ),
      //     ),
      //     const Spacer(),
      //   ],
      // ),
    );
  }
} 